package service

import (
	"context"
	"hotgo/internal/library/hgorm/handler"
	"hotgo/internal/model/input/store"

	"github.com/gogf/gf/v2/database/gdb"
)

type (
	ISysStoreProduct interface {
		// Model 商品ORM模型
		Model(ctx context.Context, option ...*handler.Option) *gdb.Model
		// List 获取商品列表
		List(ctx context.Context, in *store.StoreProductListInp) (list []*store.StoreProductListModel, totalCount int, err error)
		// Export 导出商品
		Export(ctx context.Context, in *store.StoreProductListInp) (err error)
		// Edit 修改/新增商品
		Edit(ctx context.Context, in *store.StoreProductEditInp) (err error)
		// Delete 删除商品
		Delete(ctx context.Context, in *store.StoreProductDeleteInp) (err error)
		// MaxSort 获取商品最大排序
		MaxSort(ctx context.Context, in *store.StoreProductMaxSortInp) (res *store.StoreProductMaxSortModel, err error)
		// View 获取商品指定信息
		View(ctx context.Context, in *store.StoreProductViewInp) (res *store.StoreProductViewModel, err error)
		// Status 更新商品状态
		Status(ctx context.Context, in *store.StoreProductStatusInp) (err error)
		// Switch 更新商品开关
		Switch(ctx context.Context, in *store.StoreProductSwitchInp) (err error)
	}
	ISysStoreProductAttr interface {
		// Model 商品属性ORM模型
		Model(ctx context.Context, option ...*handler.Option) *gdb.Model
		// List 获取商品属性列表
		List(ctx context.Context, in *store.StoreProductAttrListInp) (list []*store.StoreProductAttrListModel, totalCount int, err error)
		// Export 导出商品属性
		Export(ctx context.Context, in *store.StoreProductAttrListInp) (err error)
		// Edit 修改/新增商品属性
		Edit(ctx context.Context, in *store.StoreProductAttrEditInp) (err error)
		// Delete 删除商品属性
		Delete(ctx context.Context, in *store.StoreProductAttrDeleteInp) (err error)
		// View 获取商品属性指定信息
		View(ctx context.Context, in *store.StoreProductAttrViewInp) (res *store.StoreProductAttrViewModel, err error)
	}
)

var (
	localSysStoreProduct     ISysStoreProduct
	localSysStoreProductAttr ISysStoreProductAttr
)

func SysStoreProduct() ISysStoreProduct {
	if localSysStoreProduct == nil {
		panic("implement not found for interface ISysStoreProduct, forgot register?")
	}
	return localSysStoreProduct
}

func RegisterSysStoreProduct(i ISysStoreProduct) {
	localSysStoreProduct = i
}

func SysStoreProductAttr() ISysStoreProductAttr {
	if localSysStoreProductAttr == nil {
		panic("implement not found for interface ISysStoreProductAttr, forgot register?")
	}
	return localSysStoreProductAttr
}

func RegisterSysStoreProductAttr(i ISysStoreProductAttr) {
	localSysStoreProductAttr = i
}
